<%@ page import="Dao.UserDao" %>
<%@ page import="Vo.User" %><%--
  Created by IntelliJ IDEA.
  User: Cly
  Date: 2021-12-21
  Time: 15:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    request.setCharacterEncoding("utf-8");
    //String uid=request.getParameter("uid");
    User user=(User) session.getAttribute("user");
    String uid = user.getUid();
    String password1 = request.getParameter("password1");
    String password2 = request.getParameter("password2");
    String password3 = request.getParameter("password3");
    String pic = request.getParameter("pic1");
    UserDao udao = new UserDao();
    if (!user.getPassword().equals(password1)) {
        request.setAttribute("passwordMess1", "旧密码输入错误!");
        request.getRequestDispatcher("change.jsp").forward(request, response);

    } else if (!password2.equals(password3)) {
        request.setAttribute("passwordMess2", "两次密码输入不一致!");
        request.getRequestDispatcher("change.jsp").forward(request, response);
    } else {

        boolean flag = udao.changer(uid, password2, pic);
     %>修改成功<a href="home.jsp">点击跳转到首页</a><%
    }
%>
</body>
</html>
